/*********************************************************
This class is the first class a nonlinear compuatational 
unit which has only one sequence of composite vents.
The ID of this class is "A".  The class maintains the method
that depends on its own configuraton to calculate its output .
This class must be initialized with it configration first.
And then the parameters can be assigned.
Date of Modification: 14/06/2006 (dd/mm/yyyy)
*********************************************************/
#pragma once
#ifndef _TypeANCU
#define _TypeANCU
#include <algorithm>
#include "GeneralNCU.h"
#include "Misc.h"
#include "NCUGenomeSet.h"
class TypeANCU: virtual public GeneralNCU
{
public:
	// constructors
	TypeANCU();
	TypeANCU(const unsigned int &config);
	TypeANCU(const unsigned int &config, const vector<double> &paras);
	TypeANCU(const TypeANCU &rhs);
	// destructor
	virtual ~TypeANCU();
	// operator assignment
	TypeANCU& operator=(const TypeANCU &rhs);
	/*********************************************
	Configuration Section
	*********************************************/
	// get the number of parameters of a NCU
	virtual const unsigned int number() const;
	// get the type and number of the lateral outputs of a NCU
	//virtual const string configString();
	/*********************************************
	Output Section
	*********************************************/
	// assign the number of composite outputs in a NCU
	void nSequence(const unsigned int num);
	// get the number of compositel outputs
	unsigned int nSequence() const;
	// reset the initial status of a NCU
	void reset();
	/*********************************************
	Parameters Section
	*********************************************/
	// assign all parametrs of a NCU
	virtual bool parameters(const vector<double> &paras);
	// get all parameters of a NCU
	virtual vector< double> parameters() const;
	// virtual constructor
	virtual GeneralNCU* clone() const;
	// simulation and update the current sill
	virtual outputPair simulation(const double &input);
	// get the genome informatoin
	virtual vector<const GenomeType*> genome() const;
protected:
	/*********************************************
	Composite Vent Section
	*********************************************/
	// assign composite vents' values
	bool sequence(const vector<double> &paras);
	// get compoiste vents
	const CVSequence& sequence() const;
	// calculate the output of the composite outputs
	virtual double output(const double &sill);
	// calculate the output of the intermediate composite vent
	virtual double bottom(const double &sill);
	// update the current sill
	virtual void update(const double &input);
	/*********************************************
	Initial Sill Section
	*********************************************/	
	void initialSill(const double &IS);
	const double& initialSill() const;
	// check whether the number is larger than 1000
	bool check(const unsigned int &num);

	/************************************************
	Current Sill Section
	************************************************/
	// increase current sill
	void IncCurrentSill(const double &increment);
	// assign the current sill
	void currentSill(const double &sill);
	// get the current sill
	const double& currentSill() const;
private:
	CVSequence m_seq;
	double m_initialSill;
	double m_currentSill;
};
#endif